//q4.cpp
//The program gets a number and verify whether it is a polindrum
//
//Binyamin 22 december 2017
//-----------------------------------------------------------
#include <iostream>

using namespace std;

// 1. Prompt for a number.
// 2. Store the number.
// 3. calculate it reveserve.
// 4. compare the reverse and the number.

int main()
{
	int num; // num - inserted by the user.
	int num_rev; // num_rev - the reverse of num.
	int tmp; // tmp - clone of num to keep it intact.

	//init
	num_rev = 0;
	
	//prompts
	cout << "Please enter a number: ";
	cin >> num;
	tmp = num;
	while(tmp > 0)
	{
		num_rev = num_rev * 10;
		num_rev += tmp%10;
		tmp = tmp/10;
	}

	if( num == num_rev)
	{
		cout << "The number is a polindrum" << endl;
	}
	else // num != num_rev
	{
		cout << "The number is not a polindrum" << endl;
	}

	return 0;
}
//output
//Please enter a number: 34543 
//The number is a polindrum
